package com.hy.study.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * 解决返回页面中文乱码问题
 *
 * @author huyong
 * @date 2024 年 01 月 09 日 14:21: 57
 */
@Configuration
public class MyCharacterEncodingFilter extends WebMvcConfigurationSupport {
    @Bean
    public CharacterEncodingFilter characterEncodingFilter() {
        CharacterEncodingFilter encodingFilter = new CharacterEncodingFilter();
        encodingFilter.setEncoding("UTF-8");
        encodingFilter.setForceEncoding(true);
        return encodingFilter;
    }
}
